package dk.controlme.lego.common;

public enum Action {
    EXIT(0), FORWARD(1), BACKWARD(2), RIGHT(3), LEFT(4), STOP(5);

    private int id;

    Action(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public static Action getActionById(int id) {
        switch(id) {
            case 0:
                return Action.EXIT;
            case 1:
                return Action.FORWARD;
            case 2:
                return Action.BACKWARD;
            case 3:
                return Action.RIGHT;
            case 4:
                return Action.LEFT;
            case 5:
                return Action.STOP;
            default:
                return null;
        }
    }
}
